
int api_syscall(int edi, int esi, int ebp, int ebx, int edx, int ecx, int eax);

void api_putchar(int c)
{
	api_syscall(0, 0, 0, 0, 1, 0, c);
}

void api_putstr0(char *s)
{
	api_syscall(0, 0, 0, s, 2, 0, 0);
}

void api_putstr1(char *s, int l)
{
	api_syscall(	0, 		0, 		0, 		s, 		3, 		l, 		0);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_end(void)
{
	api_syscall(	0, 		0, 		0, 		0, 		4, 		0, 		0);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}	

int api_openwin(char *buf, int xsiz, int ysiz, int col_inv, char *title)
{
	return api_syscall(	ysiz, 	xsiz, 	0, 		buf, 	5, 	title, 	col_inv);
/*    api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}	

void api_putstrwin(int win, int x, int y, int col, int len, char *str)
{
	api_syscall(	y, 		x, 		str, 	win, 	6, 		len, 	col);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_boxfilwin(int win, int x0, int y0, int x1, int y1, int col)
{
	api_syscall(	y1, 	x1, 	col, 	win, 	7, 		y0, 	x0);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_point(int win, int x, int y, int col)
{
	api_syscall(	y, 		x, 		0, 		win, 	11, 	0, 		col);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_refreshwin(int win, int x0, int y0, int x1, int y1)
{
	api_syscall(	y1, 	x1, 	0, 		win, 	12, 	y0, 	x0);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_linewin(int win, int x0, int y0, int x1, int y1, int col)
{
	api_syscall(	y1, 	x1, 	col, 	win, 	13, 	y0, 	x0);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_closewin(int win)
{
	api_syscall(	0, 		0, 		0, 		win, 	14, 	0, 		0);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

int api_getkey(int mode)
{
	api_syscall(	0, 		0, 		0, 		0, 		15, 	0, 		mode);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

int api_alloctimer(void)
{
	return api_syscall(	0, 		0, 		0, 		0, 		16, 	0, 		0);
/* return api_syscall(  edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_inittimer(int timer, int data)
{
	api_syscall(	0, 		0, 		0, 		timer, 	17, 	0, 		data);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_settimer(int timer, int time)
{
	api_syscall(	0, 		0, 		0, 		timer, 	18, 	0, 		time);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_freetimer(int timer)
{
	api_syscall(	0, 		0, 		0, 		timer, 	19, 	0, 		0);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_beep(int tone)
{
	api_syscall(	0, 		0, 		0, 		0, 		20, 	0, 		tone);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

int api_fopen(char *fname)
{
	return api_syscall(	0, 		0, 		0, 		fname, 	21, 	0, 		0);
/* return api_syscall(  edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_fclose(int fhandle)
{
	api_syscall(	0, 		0, 		0, 		0, 		22, 	0, 		fhandle);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

void api_fseek(int fhandle, int offset, int mode)
{
	api_syscall(	0, 		0, 		0, 		offset, 23, 	mode, 	fhandle);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

int api_fsize(int fhandle, int mode)
{
	return api_syscall(	0, 		0, 		0, 		0, 		24, 	mode, 	fhandle);
/* return api_syscall(  edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

int api_fread(char *buf, int maxsize, int fhandle)
{
	return api_syscall(	0, 		0, 		0, 		buf, 	25, 	maxsize, fhandle);
/* return api_syscall(  edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

int api_cmdline(char *buf, int maxsize)
{
	return api_syscall(	0, 		0, 		0, 		buf, 	26, 	maxsize, 0);
/* return api_syscall(  edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

int api_getlang(void)
{
	return api_syscall(	0, 		0, 		0, 		0, 		27, 	0, 		0);
/* return api_syscall(  edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

int api_read_hard_disk_0(int LBA, char *buffer) // // return 0 -- sucess, -1 -- fail, 一次读取512个字节
{
	return api_syscall(	0, 		0, 		0, 		buffer, 28, 	0, 		LBA);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}

int api_write_hard_disk_0(int LBA, char *buffer) // // return 0 -- sucess, -1 -- fail, 一次写入512个字节
{
	return api_syscall(	0, 		0, 		0, 		buffer, 29, 	0, 		LBA);
/* api_syscall(  	edi, 	esi, 	ebp, 	ebx, 	edx, 	ecx, 	eax  );*/
}
